package codeforces;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class NextRound {

	public static void main(String[] args) {
		int n, k;
		List<Integer> points = new ArrayList<Integer>();
		
		Scanner s = new Scanner(System.in);
		n = s.nextInt();
		k = s.nextInt();
		int i = 0;
		while(i != n) {
			points.add(s.nextInt());
			i++;
		}
		int posValue = points.get(k - 1);
		int result = 0;
		for(Integer j : points) {
			if(j >= posValue && j > 0) {
				result++;
			}
		}
		System.out.println(result);
	}

}
